Trò chơi Pac-Man

20.575 lượt xem;
1 using UnityEngine;
2 using
System.Collections;
3
4 public
class Energizer : MonoBehaviour {
5
6     
private GameManager gm;
7
8     
// Use this for initialization
9     
void Start ()
10     {
11         gm = GameObject.Find(
"Game Manager").GetComponent<GameManager>();
12         
if( gm == null ) Debug.Log("Energizer did not find Game Manager!");
13     }
14
15     
void OnTriggerEnter2D(Collider2D col)
16     {
17         
if(col.name == "pacman")
18         {
19             gm.ScareGhosts();
20             Destroy(gameObject);
21         }
22     }
23 }


Use this for initialization



Gõ tìm kiếm nhanh...